home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 4.2 KB | 81 lines | [TEXT/GEOL] |
- Item 2847445 1-Aug-90 20:01PDT
-
- From: N0917 E I DuPont, Simon Edkins,ASC,NAT
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: TextEdit Problem
-
- I have devised a feature of the interface for my current MacApp application
- which, if it can be implemented, will be very slick and much better than what
- is in place now. The problem is, I am still somewhat of a MacApp novice and
- can’t figure out how to do what I want. (I have Dave Wilson’s book on order,
- but it hasn’t arrived yet.)
- My application window contains a view which displays a plot of data
- generated by another program. (The plot is a pair of continuous waveforms, and
- all that works just fine, so it has no bearing on my problem.)
- But part of the functionality of my program is to give the user the ability
- to click on any part of the plot (such as the tip of the peak of a wave) and
- tell the program (by typing in a number) something about that data point (in
- this case, an equivalence of time to molecular size). Right now I am using a
- modeless dialog to hold the TextEdit rect and a couple of buttons. It works,
- but is very clunky because of all the clicking back and forth between the
- document window and dialog (the click-and-type process is typically repeated
- about ten times). I would like to be able to do away with the dialog window
- entirely and present the user with a flashing cursor right at the point where
- the mouse was clicked in the plot view. Then the process would be: click, type
- 2 or 3 digits, and then enter (or return) to send the number off to storage,
- remove the TE, and return to a readiness for the next click.
- I have tried to implement this with a TNumberText object as a subview of
- the plotting view, even though my window is not a ‘dialog’ (as MacApp
- understands it). I am using a ViewEdit resource template, with the TNumberText
- placed initially in the middle of its superview and not shown. I show it when
- the mouse is clicked in the plot view. That part works, I think. At least, the
- TE rectangle appears when and where I expect it. But there is something wrong
- with either my instantiation of the object or my handling of the target chain
- because my experimental mousedown in the TE invokes the debugger with a “nil
- handle” error message (my DoMouseCommand for the object simply beeps, so I can
- tell it took the click).
- So finally my question, which really has several parts. One, is what I am
- trying to do reasonable and possible? Two, can I use TNumberText in this case,
- even though I am not working with a dialog view? Three, is there some trick to
- instantiating a subview such as this, or does FindSubView do the job? Four,
- how does one switch gTarget reliably, and in such a way that a TE would not
- only appear on screen, but flash its insertion point invitingly and immediately
- accept keyboard input?
- And five (looking ahead and assuming this can all be made to work as I have
- tried to describe it), how does one handle the case of the user who clicks,
- gets the insertion point, then decides to click somewhere else in the plot
- view, which is no longer the target (or is this handled automatically by the
- click chain?)?
-
- Here are a couple of my relevant code fragments which may help illuminate the
- problem.
-
- In MyDocument.DoMakeViews:
-
- aPlotView := TFPView(aView.FindSubView('plot'));
- aPlotView.fMyDoc := SELF; {the view now has a reference to its document}
- SELF.fThisView := aPlotView; {the document now has a reference to this view}
- {now find the TNumberText subview} {‘Mers’ refers to subcomponents of a
- nucleic acid}
- aMersEntry := TFPMersEntry(aPlotView.FindSubView('tntx'));
- aPlotView.fMersEntry := aMersEntry;
-
-
- And in my Plotting View’s DoMouseCommand:
-
- {after some processing of the click position and displaying a number related to
- it...}
-
- fMersEntry.SetText('', TRUE); {so the TE appears with no text showing}
- AddSubView(fMersEntry); {one attempt to make sure of the end of the target
- chain}
- fMersEntry.Show(TRUE, TRUE); {show the text entry box}
-
- gApplication.SetTarget(fMersEntry); {make it the target}
-
- Thanks in advance to anyone who has any helpful suggestions or solutions, or
- better yet has done something like this already.
-
-